package tencent

import (
	"context"
	"github.com/gogf/gf/v2/frame/g"
	"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
)

var Config = tencentConfig{
	accessId:  g.Config().MustGet(context.Background(), "app.tencent.accessId").String(),
	accessKey: g.Config().MustGet(context.Background(), "app.tencent.accessKey").String(),
}

type tencentConfig struct {
	accessId  string
	accessKey string
}

func (r tencentConfig) NewCredential() *common.Credential {
	// 实例化一个认证对象，入参需要传入腾讯云账户secretId，secretKey,此处还需注意密钥对的保密
	// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
	return common.NewCredential(
		r.accessId, r.accessKey,
	)
}
